package log

import (
	"fmt"
	"net"
	"runtime"
)

func Log(err error) {
	if err != nil {
		fmt.Printf("出现错误： %v\n", err)
	}
}

func LogClose(err error, conn net.Conn) {
	if err != nil {
		runtime.Goexit()
	}
}

func LogExit(err error) {
	if err != nil {
		fmt.Printf("出现错误，退出线程： %v\n", err)
		runtime.Goexit()
	}
}

func Dail(tcpUrl string) net.Conn {
	conn, err := net.Dial("tcp", tcpUrl)
	LogExit(err)
	return conn
}
